package radiostation;

import java.awt.event.WindowEvent;
import java.awt.event.WindowListener;
import javax.swing.JOptionPane;

public class BaseJFrame extends javax.swing.JFrame {

    public void showWarningMessage(String message) {
        JOptionPane.showMessageDialog(this, message, "Σφάλμα",
                JOptionPane.WARNING_MESSAGE);
    }
    
    public void showMessage(String message) {
        JOptionPane.showMessageDialog(this, message, "Μήνυμα",
                        JOptionPane.INFORMATION_MESSAGE);
    }

    public int showPrompt(String title, String message) {
        return JOptionPane.showConfirmDialog(this, message, title, JOptionPane.YES_NO_OPTION);
    }

    public void closeFrame(boolean exitAndSave) {
        MyWindowEvent we = new MyWindowEvent(this, WindowEvent.WINDOW_CLOSED, exitAndSave);
        for (WindowListener l : this.getWindowListeners()) {
            l.windowClosed(we);
        }
        this.setVisible(false);
    }

}
